<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增课程信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-course-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">课程名称：</label>
                <div class="col-sm-8">
                    <input name="courseName" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">年度：</label>
                <div class="col-sm-8">
                    <input name="courseYear" class="form-control" type="number" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">上/下学期：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('cws_up_down_term')}">
                        <input type="radio" th:id="${'isUp_' + dict.dictCode}" name="isUp" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
                        <label th:for="${'isUp_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">课程类型：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('cws_course_type')}">
                        <input type="radio" th:id="${dict.dictCode}" name="courseType" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
                        <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">教师：</label>
                <div class="col-sm-8">
                    <select class="form-control m-b" name="teacherId" required>
                        <option value=""></option>
                        <option th:each="teacher : ${teachers}" th:text="${teacher.userName}"
                                th:value="${teacher.userId}">
                        </option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">班级：</label>
                <div class="col-sm-8">
                    <select class="form-control m-b" name="clazzId" required>
                        <option value=""></option>
                        <option th:each="clazz : ${clazzs}" th:text="${clazz.clazzName}"
                                th:value="${clazz.clazzId}">
                        </option>
                    </select>
                </div>
            </div>
            <h4 class="form-header h4">其他信息</h4>
            <div class="form-group">    
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="remark" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "cws/course"
        $("#form-course-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-course-add').serialize());
            }
        }
    </script>
</body>
</html>